{% extends "base.html" %}
{% load i18n %}

{% block extrahead %}
<!-- looks like this never gets into the output -->
{% endblock %}

{% block content %}
    <style type="text/css">
    .course {
	border: 1px solid black;
	margin-left: 1em;
	margin-top: 0.5em;
	padding: 0.5em;
    }
    .course table td {
	padding-top: 0;
	padding-bottom: 0;
	padding-left: 0;
	padding-right: 0.25em;
	font-size: 10pt;
	vertical-align: top;
    }
    .markDescription {
	font-style: italic;
    }
    .maximumPoints {
	color: grey;
    }
    .categoryAverage {
        font-weight: bold;
    }
    .markMark {
        white-space: nowrap;
    }
    .studentSelector {
        list-style-type: none;
        margin: 0;
        padding: 0;
    }
    .studentSelector li {
        display: inline;
    }
    </style>
    {% if available_students.count > 1 %}
        <ul class="studentSelector">
        {% for a in available_students %}
            <li>
            {% if a == student %}
            <strong>{{ a.fname }} {{ a.lname }}</strong>
            {% else %}
            <a href="?student_username={{ a.username }}">{{ a.fname }} {{ a.lname }}</a>
            {% endif %}
            {% if not forloop.last %} | {% endif %}
            </li>
        {% endfor %}
        </ul>
    {% endif %}
    {% if error_message %}
        <p>{{ error_message }}</p>
    {% else %}
        <h1>Grades for {{ student.fname }} {{ student.lname }} as of {{ today }}</h1>
    {% endif %}
    {% for mp in mps %}
	<h2>{{ mp.name }}</h2>
	{% for course in mp.courses %}
	    <div class="course">
		<h3>{{ course.fullname }}</h3>
		<table>
		    <tr>
			{% for category in course.categories %}
			{% if category.marks %}
			    <td>
				<h4>{{ category.name }}</h4>
				<table>
				{% for mark in category.marks %}
				    <tr>
					<td>
					    {% if mark.item.name != 'None' %}
						{{ mark.item.name }}
					    {% endif %}
					    <!-- Dillon only wants students to see Session marks
					    {% if mark.description %}
						<br /><span class="markDescription">{{ mark.description }}</span>
					    {% endif %}
					    -->
					</td>
					<td class="markMark">{{ mark.mark }} <span class="maximumPoints">(of {{ mark.item.scale.maximum }})</span></td>
				    </tr>
				{% endfor %}
				</table>
			    </td>
			{% endif %}
			{% endfor %}
		    </tr>
		    <tr>
			{% for category in course.categories %}
			{% if category.marks %}
			    <td class="categoryAverage">
				Average: {{ category.average }}
			    </td>
			{% endif %}
			{% endfor %}
		    </tr>
		</table>
	    </div>
	{% endfor %}
    {% endfor %}
{% endblock %}
